import type { RouteRecordRaw } from 'vue-router'

const routes: Array<RouteRecordRaw> = [
    {
        path: '/',
        redirect: '/home'
    },
    {
        path: '/admin',
        name: 'Admin', 
        component: () => import('../views/layout/index.vue'),
        redirect: '/admin/dashboard',
        children: [
            {
                path: 'dashboard',
                name: 'Dashboard',
                component: () => import('../views/admin/dashboard/index.vue'),
                meta: {
                    title: '控制台',
                    icon: 'dashboard'
                }
            },
            {
                path: 'photos',
                name: 'PhotosManage',
                component: () => import('../views/admin/photos/index.vue'),
                meta: {
                    title: '照片管理',
                    icon: 'photos'
                }
            },
            {
                path: 'article',
                name: 'ArticleManage',
                component: () => import('../views/admin/article/index.vue'),
                meta: {
                    title: '文章管理',
                    icon: 'article'
                },
                children: [
                    {
                        path: 'list',
                        name: 'ArticleList',
                        component: () => import('../views/admin/article/list.vue'),
                        meta: {
                            title: '文章列表',
                            icon: 'list'
                        }
                    },
                    {
                        path: 'edit',
                        name: 'ArticleAdd',
                        component: () => import('../views/admin/article/edit/index.vue'),
                        meta: {
                            title: '写文章',
                            icon: 'edit',
                            hidden: true
                        }
                    },
                    {
                        path: 'edit/:id',
                        name: 'ArticleEdit',
                        component: () => import('../views/admin/article/edit/index.vue'),
                        meta: {
                            title: '编辑文章',
                            icon: 'edit',
                            hidden: true
                        }
                    }
                ]
            },
            {
                path: 'comment',
                name: 'CommentManage',
                component: () => import('../views/admin/comment/index.vue'),
            },
            {
                path: 'moments',
                name: 'MomentsManage',
                component: () => import('../views/admin/moments/index.vue'),
                meta: {
                    title: '我的说说',
                    icon: 'chat-line-round'
                }
            },
            {
                path: 'investment',
                name: 'InvestmentManage',
                meta: {
                    title: '投资管理',
                    icon: 'investment'
                },
                children: [
                    {
                        path: 'summary',
                        name: 'InvestmentSummary',
                        component: () => import('../views/admin/investment/summary.vue'),
                        meta: {
                            title: '投资小结',
                            icon: 'summary'
                        }
                    },
                    {
                        path: 'portfolio',
                        name: 'PortfolioManage',
                        component: () => import('../views/admin/investment/portfolio.vue'),
                        meta: {
                            title: '持仓管理',
                            icon: 'portfolio'
                        }
                    }
                ]
            },
            {
                path: 'access-log',
                name: 'AccessLog',
                component: () => import('../views/access-log/index.vue'),
                meta: {
                    title: '访问日志',
                    icon: 'access-log'
                }
            }
        ]
    },
    {
        path: '/home',
        name: 'Home',
        component: () => import('../views/home/index.vue')
    },
    {
        path: '/login',
        name: 'Login',
        component: () => import('../views/login/login.vue')
    },
    {
        path: '/tech',
        name: 'TechBlog',
        component: () => import('../views/tech/index.vue')
    },
    {
        path: '/tech/:id',
        name: 'TechDetail',
        component: () => import('@/views/tech/detail.vue')
    },
    {
        path: '/life',
        name: 'LifeBlog',
        component: () => import('../views/life/index.vue')
    },
    {
        path: '/life/:id',
        name: 'LifeDetail',
        component: () => import('../views/life/detail.vue')
    },
    {
        path: '/about',
        name: 'About',
        component: () => import('../views/about/index.vue')
    },
    {
        path: '/guestbook',
        name: 'Guestbook',
        component: () => import('../views/guestbook/index.vue')
    },
    {
        path: '/photos',
        name: 'photos',
        component: () => import('../views/photos/index.vue')
    },
    {
        path: '/code-generator',
        name: 'CodeGenerator',
        component: () => import('../views/code-generator/index.vue')
    },
    {
        path: '/private',
        name: 'Private',
        component: () => import('../views/private/index.vue'),
        meta: {
            title: '私密空间'
        }
    },
    {
        path: '/moments',
        name: 'Moments',
        component: () => import('@/views/moments/index.vue'),
        meta: {
            title: '说说'
        }
    },
    {
        path: '/docs',
        name: 'TechDocs',
        component: () => import('../views/docs/index.vue'),
        meta: {
            title: '开发文档',
            icon: 'document'
        }
    }
]

export default routes